<template>
	<view>
		<!-- <topbar title="动态管理" background="background:#7ADEEC"></topbar> -->
		<view>
			<view class="dhl" style="background-color: #7ADEEC;"></view>
			<view class="topbar box dis_f_c_c" style="background-color: #7ADEEC;color: #000;">
					广告管理
			<image  class="top_jt" src="../../static/icon/back.png" mode="aspectFit" @click="go_back"></image>
			</view>
		</view>
		<view class="content dis_f_co" >
			<view class="tab">
				<u-tabs :list="list" bg-color="none" active-color="#222222" bar-width="196" bar-height="4" inactive-color="#BBBBBB" :is-scroll="false" :current="current" @change="change"></u-tabs>
			</view>
			<view class="dt_xq dis_f_co" v-for="(item,index) in quan" @click="goxq(item.id)">
				<view class="dis_f_sb_c" style="margin-bottom: 28rpx;">
					<view class="dis_f_l_c" >
						<view class="tx">
							<image class="tx_img" :src="item.user.avatar" mode=""></image>
							<image class="sex" :src="sex_src" mode=""></image>
						</view>
						<view class="dis_f_co">
							<view class="title">{{item.user.name}}</view>
							<view class="sign">{{item.user.sign}}</view>
						</view>
					</view>
					<view style="font-size: 22rpx;color: #BBB;">{{item.create_time}}</view>
				</view>
				<view style="font-size: 22rpx;margin-bottom: 24rpx;" class="hh">{{item.content}}</view>
				<view class="dis_f_l_c dis_f_w img_list">
					<image v-if="item.type ==2" :src="item.video_pic" mode="" @click.stop="previewVideo(item.pic[0])"></image>
					<image v-for="(items,indexs) in item.pic" :src="items" mode=""></image>
				</view>
				<view class="dis_f_l_c b_btn">
				<!-- <view class="dis_f_l_c" style="margin-right: 60rpx;">
					<image  src="../../static/guang_chang/sl.png" mode=""></image>
					<view style="color: #7ADEEC;">私聊</view>
				</view> -->
				<view class="dis_f_l_c" style="margin-right: 60rpx;">
					<image  src="../../static/index/s_btn2.png" mode=""></image>
					<view>{{item.talknum}}</view>
				</view>
				<view class="dis_f_l_c" style="margin-right: 60rpx;">
					<image  src="../../static/index/s_btn4.png" mode=""></image>
					<view>{{item.zan}}</view>
				</view>
					<view class="dis_f_l_c">
						<image style="width: 32.07rpx;height: 31.29rpx;margin-right: 12rpx;" src="../../static/guang_chang/delet.png" mode=""></image>
						<view style="font-size: 22rpx;color: #E23C63;" @click.stop="del(item.id)">删除</view>
					</view>
				</view>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					name: '待审核'
				},{
					name: '显示中'
				}, {
					name: '已下架'
				}, ],
				current: 1,
				sex_src:'',
				text:'',
				show:false,
				quan:[]
			};
		},
		onLoad() {
			this.getquan(this.current)
			this.get_userinfo()
			
		},
		methods:{
			change(index) {
				console.log(index)
				this.current = index;
				if(index == 0){
					this.quan=[]
				// 	this.status_true = false;
					this.getquan(0)
				}else if(index == 1){
					this.quan=[]
				// 	this.status_true = true;
					this.getquan(1)
				}
				else{
					this.quan=[]
				// 	this.status_true = false;
				this.getquan(2)
					
				}
				},
			onBackPress(e) {
			    console.log(e);
				// return;
			    if(e.from == 'backbutton'){
					uni.switchTab({
						url:'/pages/mine/mine'
					})
			    return true;//阻止默认返回行为
			    }
				 return true;//阻止默认返回行为
			},
			previewVideo(src) {
				console.log(src);
				this.previewVideoSrc = src;
				// this.previewVideoSrc =
				// 	'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-fbd63a76-dc76-485c-b711-f79f2986daeb/ba804d82-860b-4d1a-a706-5a4c8ce137c3.mp4'
			},
			go_back(){
				this.$.open_tab('/pages/mine/mine')
			},
			getquan(e){
				this.$.ajax(1, 'post', 'index/getquan', {
					uid:uni.getStorageSync('uid'),
					token:uni.getStorageSync('token'),
					status:1,
					statuess:e
				}, (res) => {
					console.log(res)
					if(res.code == 1){
						this.quan = res.list
					}
				})
			},
			del(e){
				this.$.ajax(1, 'post', 'index/checktokens', {
					uid:uni.getStorageSync('uid'),
					token:uni.getStorageSync('token')
				}, (res) => {
					console.log(res)
					if(res.code == 9){
						this.$.ti_shi('token已过期，请重新登陆')
					uni.clearStorageSync()
						setTimeout( () => {
							uni.navigateTo({
								url:'/pages/login/login'
							})
						}, 1000)
					return;
					}
					else{
					this.$.ajax(1, 'post', 'index/delquan', {
							uid:uni.getStorageSync('uid'),
							token:uni.getStorageSync('token'),
							id:e
						}, (res) => {
							console.log(res)
							if(res.code == 1){
								this.$.ti_shi(res.msg)
								this.$.open('/pages/guang_chang/dt_gl')
							}
						})
					}
				})
				
			},
			get_userinfo(){
				let sex = 1
				if(sex == 1){
					this.sex_src = '../../static/mine/man.png'
				}
				if(sex == 0){
					this.sex_src = '../../static/mine/women.png'
				}
			},
			goxq(e){
				this.$.ajax(1, 'post', 'index/checktokens', {
					uid:uni.getStorageSync('uid'),
					token:uni.getStorageSync('token')
				}, (res) => {
					console.log(res)
					if(res.code == 9){
						this.$.ti_shi('token已过期，请重新登陆')
					uni.clearStorageSync()
						setTimeout( () => {
							uni.navigateTo({
								url:'/pages/login/login'
							})
						}, 1000)
					return;
					}
					else{
							this.$.open('/pages/guang_chang/dt_xq?id='+e)
					}
				})
				
			},
		}
	}
</script>

<style lang="scss">
	.dhl {
		// position: absolute;
		width: 100%;
		height: var(--status-bar-height);
		position: fixed;
		top: 0;
		z-index: 999;
	}
	.topbar {
		width: 100%;
		z-index: 999;
		height: 88rpx;
		position: fixed;
		top: var(--status-bar-height);
		font-size: 34rpx;
		color: #212730;
		font-weight: bold;
		// background-image: url(../../static/index/bg.png);
		// padding: 0 0 26rpx 0rpx;
		
		.top_jt {
			width: 18rpx;
			height: 32rpx;
			position: absolute;
			left: 40rpx;
			top: 28rpx;
		}
	}
	.t_c{
		padding: 0 24rpx;
		width: 100%;
		height: 100rpx;
		background-color: #f6f6f6;
		.btns{
			margin-left: 12rpx;
			width: 86rpx;
			height: 46rpx;
			background-color: #2979ff;
			color: #fff;
			border-radius: 10rpx;
		}
	}
	.pl_btn{
		position: fixed;
		bottom: 90rpx;
		right: 24rpx;
		image{
			width: 66rpx;
			height: 66rpx;
			margin-right: 24rpx;
		}
		
	}
	.pl_btn image:last-child{
			width: 138rpx;
	}
	.content{
		width: 100%;
		padding: calc(var(--status-bar-height) + 128rpx) 24rpx 0 24rpx;
		.ping_lun{
			
			width: 100%;
			padding: 36rpx 24rpx;
			border-radius: 20rpx;
			box-shadow: 0rpx 6rpx 24rpx rgba(34, 34, 34, 0.05);
			background-color: #fff;
			.list{
				.zan{
					width: 28.6rpx;
					height: 28.6rpx;
					margin-right: 12rpx;
				}
				padding: 26rpx 0;
				width: 100%;
				border-bottom: 2rpx solid #EEE;
				.tx{
					width: 56rpx;
					height: 56rpx;
					border-radius: 50%;
					margin-right: 12rpx;
				}
			}
		}
		.dt_xq{
			width: 100%;
			padding: 36rpx 24rpx;
			background-color: #fff;
			margin-bottom: 12rpx;
			border-radius: 20rpx;
			box-shadow: 0rpx 6rpx 24rpx rgba(34, 34, 34, 0.05);
			.tx{
				width: 76rpx;
				height: 76rpx;
				margin-right: 24rpx;
				position: relative;
				.tx_img{
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}
				.sex{
					position: absolute;
					bottom: 0;
					right: 0;
					width: 30rpx;
					height: 30rpx;
				}
			}
			.img_list{
				width: 100%;
				margin-bottom: 50rpx;
				image{
					width: 204rpx;
					height: 204rpx;
					border-radius: 10rpx;
					margin-bottom: 10rpx;
					margin-right: 10rpx;
				}
			}
			.title{
				font-size: 28rpx;
				line-height: 40rpx;
				margin-bottom: 6rpx;
			}
			.sign{
				font-size: 22rpx;
				color: #BBB;
			}
			.gz_btn{
				width: 108rpx;
				height: 48rpx;
				background-color: #E23C63;
				border-radius: 28rpx;
				font-size: 22rpx;
				color: #fff;
			}
			.b_btn{
				font-size: 22rpx;
				line-height: 32rpx;
				color: #777;
				image{
					margin-right: 12rpx;
					width: 37.13rpx;
					height: 32.88rpx;
				}
			}
		}
	}
</style>
